using System;
using System.Xml;

namespace LocalBoard.Domain
{
	public enum ClubType
	{
		Public,
		Private,
		Hidden
	}

	/// <summary>
	/// Summary description for Club.
	/// </summary>
	public class Club
	{
		public Club(int id, string uniqueName, string name, int categoryId, string description, string clubTypeString, XmlNode information)
		{
			Initialize(id, uniqueName, name, categoryId, description, ParseClubTypeString(clubTypeString), information);
		}
		public Club(int id, string uniqueName, string name, int categoryId, string description, ClubType clubType, XmlNode information)
		{
			Initialize(id, uniqueName, name, categoryId, description, clubType, information);
		}
		public Club(string uniqueName, string name, int categoryId, string description, ClubType clubType, XmlNode information)
		{
			Initialize(0, uniqueName, name, categoryId, description, clubType, information);
		}
		public Club(string uniqueName, string name, int categoryId, string description, string clubTypeString, XmlNode information)
		{
			Initialize(0, uniqueName, name, categoryId, description, ParseClubTypeString(clubTypeString), information);
		}

		private void Initialize(int id, string uniqueName, string name, int categoryId, string description, ClubType clubType, XmlNode information)
		{
			_id = id;
			_uniqueName = uniqueName;
			_name = name;
			_categoryId = categoryId;
			_description = description;
			_clubType = clubType;
			_information = information;
		}

		private ClubType ParseClubTypeString(string clubTypeString)
		{
			if(clubTypeString == null || clubTypeString.Length == 0)
				return ClubType.Public;
			else
				return (ClubType)Enum.Parse(typeof(ClubType), clubTypeString, true);
		}

		private int _id;
		private string _uniqueName;
		private string _name;
		private int _categoryId;
		private string _description;
		private ClubType _clubType = ClubType.Public;
		private XmlNode _information;

		public int Id
		{
			get {return _id;}
		}
		public string UniqueName
		{
			get {return _uniqueName;}
			set {_uniqueName = value;}
		}
		public string Name
		{
			get {return _name;}
			set {_name = value;}
		}
		public int CategoryId
		{
			get {return _categoryId;}
			set {_categoryId = value;}
		}
		public string Description
		{
			get {return _description;}
			set {_description = value;}
		}
		public ClubType ClubType
		{
			get {return _clubType;}
			set {_clubType = value;}
		}
		public XmlNode Information
		{
			get {return _information;}
			set {_information = value;}
		}
	}
}